<!DOCTYPE html>
<html>
<!-- Created by GNU Texinfo 7.1.1, https://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Copyright © 1987-2023 Free Software Foundation, Inc.

Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation.  A copy of
the license is included in the
section entitled "GNU Free Documentation License".

This manual contains no Invariant Sections.  The Front-Cover Texts are
(a) (see below), and the Back-Cover Texts are (b) (see below).

(a) The FSF's Front-Cover Text is:

A GNU Manual

(b) The FSF's Back-Cover Text is:

You have freedom to copy and modify this GNU Manual, like GNU
     software.  Copies published by the Free Software Foundation raise
     funds for GNU development. -->
<title>Preprocessor Output (The C Preprocessor)</title>

<meta name="description" content="Preprocessor Output (The C Preprocessor)">
<meta name="keywords" content="Preprocessor Output (The C Preprocessor)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta name="viewport" content="width=device-width,initial-scale=1">

<link href="index.html" rel="start" title="Top">
<link href="Index-of-Directives.html" rel="index" title="Index of Directives">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html" rel="up" title="Top">
<link href="Traditional-Mode.html" rel="next" title="Traditional Mode">
<link href="Other-Directives.html" rel="prev" title="Other Directives">
<style type="text/css">
<!--
a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
div.example {margin-left: 3.2em}
span:hover a.copiable-link {visibility: visible}
-->
</style>


</head>

<body lang="en">
<div class="chapter-level-extent" id="Preprocessor-Output">
<div class="nav-panel">
<p>
Next: <a href="Traditional-Mode.html" accesskey="n" rel="next">Traditional Mode</a>, Previous: <a href="Other-Directives.html" accesskey="p" rel="prev">Other Directives</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
</div>
<hr>
<h2 class="chapter" id="Preprocessor-Output-1"><span>9 Preprocessor Output<a class="copiable-link" href="#Preprocessor-Output-1"> &para;</a></span></h2>

<p>When the C preprocessor is used with the C, C++, or Objective-C
compilers, it is integrated into the compiler and communicates a stream
of binary tokens directly to the compiler&rsquo;s parser.  However, it can
also be used in the more conventional standalone mode, where it produces
textual output.
</p>
<a class="index-entry-id" id="index-output-format"></a>
<p>The output from the C preprocessor looks much like the input, except
that all preprocessing directive lines have been replaced with blank
lines and all comments with spaces.  Long runs of blank lines are
discarded.
</p>
<p>The ISO standard specifies that it is implementation defined whether a
preprocessor preserves whitespace between tokens, or replaces it with
e.g. a single space.  In GNU CPP, whitespace between tokens is collapsed
to become a single space, with the exception that the first token on a
non-directive line is preceded with sufficient spaces that it appears in
the same column in the preprocessed output that it appeared in the
original source file.  This is so the output is easy to read.
CPP does not insert any
whitespace where there was none in the original source, except where
necessary to prevent an accidental token paste.
</p>
<a class="index-entry-id" id="index-linemarkers"></a>
<p>Source file name and line number information is conveyed by lines
of the form
</p>
<div class="example smallexample">
<pre class="example-preformatted"># <var class="var">linenum</var> <var class="var">filename</var> <var class="var">flags</var>
</pre></div>

<p>These are called <em class="dfn">linemarkers</em>.  They are inserted as needed into
the output (but never within a string or character constant).  They mean
that the following line originated in file <var class="var">filename</var> at line
<var class="var">linenum</var>.  <var class="var">filename</var> will never contain any non-printing
characters; they are replaced with octal escape sequences.
</p>
<p>After the file name comes zero or more flags, which are &lsquo;<samp class="samp">1</samp>&rsquo;,
&lsquo;<samp class="samp">2</samp>&rsquo;, &lsquo;<samp class="samp">3</samp>&rsquo;, or &lsquo;<samp class="samp">4</samp>&rsquo;.  If there are multiple flags, spaces
separate them.  Here is what the flags mean:
</p>
<dl class="table">
<dt>&lsquo;<samp class="samp">1</samp>&rsquo;</dt>
<dd><p>This indicates the start of a new file.
</p></dd>
<dt>&lsquo;<samp class="samp">2</samp>&rsquo;</dt>
<dd><p>This indicates returning to a file (after having included another file).
</p></dd>
<dt>&lsquo;<samp class="samp">3</samp>&rsquo;</dt>
<dd><p>This indicates that the following text comes from a system header file,
so certain warnings should be suppressed.
</p></dd>
<dt>&lsquo;<samp class="samp">4</samp>&rsquo;</dt>
<dd><p>This indicates that the following text should be treated as being
wrapped in an implicit <code class="code">extern &quot;C&quot;</code> block.
</p></dd>
</dl>

<p>As an extension, the preprocessor accepts linemarkers in non-assembler
input files.  They are treated like the corresponding &lsquo;<samp class="samp">#line</samp>&rsquo;
directive, (see <a class="pxref" href="Line-Control.html">Line Control</a>), except that trailing flags are
permitted, and are interpreted with the meanings described above.  If
multiple flags are given, they must be in ascending order.
</p>
<p>Some directives may be duplicated in the output of the preprocessor.
These are &lsquo;<samp class="samp">#ident</samp>&rsquo; (always), &lsquo;<samp class="samp">#pragma</samp>&rsquo; (only if the
preprocessor does not handle the pragma itself), and &lsquo;<samp class="samp">#define</samp>&rsquo; and
&lsquo;<samp class="samp">#undef</samp>&rsquo; (with certain debugging options).  If this happens, the
&lsquo;<samp class="samp">#</samp>&rsquo; of the directive will always be in the first column, and there
will be no space between the &lsquo;<samp class="samp">#</samp>&rsquo; and the directive name.  If macro
expansion happens to generate tokens which might be mistaken for a
duplicated directive, a space will be inserted between the &lsquo;<samp class="samp">#</samp>&rsquo; and
the directive name.
</p>
</div>
<hr>
<div class="nav-panel">
<p>
Next: <a href="Traditional-Mode.html">Traditional Mode</a>, Previous: <a href="Other-Directives.html">Other Directives</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index-of-Directives.html" title="Index" rel="index">Index</a>]</p>
</div>



</body>
</html>
